package com.czk.pojo;

import lombok.ToString;

/**
 * token的封装
 *
 * @Author:ChenZhangKun
 * @Date: 2021/8/2 17:37
 */
@ToString
public class AccessToken {
    private String accessToken;
    private Long expireTime;

    public AccessToken(String accessToken, String expireIn) {
        super();
        this.accessToken = accessToken;
        expireTime = System.currentTimeMillis() + Integer.parseInt(expireIn) * 1000;

    }

    public boolean isExpired() {
        return System.currentTimeMillis() > expireTime;
    }

    public String getAccessToken() {
        return accessToken;
    }

    public void setAccessToken(String accessToken) {
        this.accessToken = accessToken;
    }

    public Long getExpireTime() {
        return expireTime;
    }

    public void setExpireTime(Long expireTime) {
        this.expireTime = expireTime;
    }
}
